package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: Rodgers
 * @Date 2022/3/8 10:29
 */
public interface EmployeeMapper {

    /**
     * 登录
     * @param employee
     * @return
     */
    @Select("select * from employee where username=#{username}")
    Employee login(Employee employee);


    /**
     * 添加用户
     * @param employee
     * @return
     */
    @Insert("insert into employee values(null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    Long save(Employee employee);

    /**
     * 分页查找
     * @param name
     * @return
     */
    List<Employee> findByName(@Param("name") String name);

    /**
     * 修改员工数据
     * @param employee
     * @return
     */
    Integer update(Employee employee);

    /**
     * 通过Id查询
     * @param id
     * @return
     */
    Employee selectById(Long id);

}
